package com.company;

import java.util.Random;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner scan = new Scanner(System.in);
        Random random = new Random();
        int ran = random.nextInt(100);
        for (int i = 7; i > 0; i--){
            System.out.println("还有" + i + "次机会！");
            System.out.println("请输入一个整数：");
            int number = scan.nextInt();
            if (number == ran){
                System.out.println("恭喜你！猜对了！");
                return;
            }else if (number > ran){
                System.out.println("猜大了！");
            }else {
                System.out.println("猜小了！");
            }
            if (i == 1){
                System.out.println("机会用完了！");
                return;
            }
        }
    }
}
